Exemplar-based natural language processing

ABSTRACT

Systems and processes for exemplar-based natural language processing are provided. In one example process, a first text phrase can be received. It can be determined whether editing the first text phrase to match a second text phrase requires one or more of inserting, deleting, and substituting a word of the first text phrase. In response to determining that editing the first text phrase to match the second text phrase requires one or more of inserting, deleting, and substituting a word of the first text phrase, one or more of an insertion cost, a deletion cost, and a substitution cost can be determined. A semantic edit distance between the first text phrase and the second text phrase in a semantic space can be determined based on one or more of the insertion cost, the deletion cost, and the substitution cost.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a Continuation application of U.S. Ser. No. 14/503,128, filed on Sep. 30, 2014, entitled EXEMPLAR-BASED NATURAL LANGUAGE PROCESSING, which claims priority from U.S. Provisional Ser. No. 62/005,786, filed on May 30, 2014, entitled EXEMPLAR-BASED NATURAL LANGUAGE PROCESSING, which is hereby incorporated by reference in its entirety for all purposes.

FIELD

This relates generally to natural language processing and, more specifically, to exemplar-based natural language processing.

BACKGROUND

Natural language input can be written or spoken input (e.g., speech or text) that is in a natural form used by a person when speaking or writing to another person. Natural language input can permit a user to easily interact with an electronic device using well-known language. For example, a virtual assistant operating on an electronic device can enable a user to access various services of the electronic device through natural language input to the virtual assistant. The virtual assistant can perform natural language processing on the natural language input to determine user intent from the natural language input. The determined user intent can then be operationalized into tasks that are executed by the virtual assistant.

Natural language processing can be implemented by parsing and recognizing individual words or groups of words in the natural language input to determine the user intent associated with the input. However, due to the complex and shifting “rules” of human natural language, the overall meaning of a natural language input can be missed by recognizing small portions of natural language input separately. In addition, a given user intent can be expressed in many unanticipated ways using natural language. According, determining user intent by recognizing small portions of natural language input separately can yield inaccurate or incomplete results.

SUMMARY

Systems and processes for exemplar-based natural language processing are provided. In one example process, a first text phrase can be received. It can be determined whether editing the first text phrase to match a second text phrase requires one or more of inserting a first word into the first text phrase, deleting a second word from the first text phrase, and substituting a third word of the first text phrase with a fourth word. The second text phrase can include the first word, the first text phrase can include the second word, and the second text phrase can include the fourth word. In response to determining that editing the first text phrase to match the second text phrase requires one or more of inserting the first word into the first text phrase, deleting the second word from the first text phrase, and substituting the third word of the first text phrase with the fourth word, one or more of an insertion cost, a deletion cost, and a substitution cost can be determined. It can be determined, based on the one or more of the insertion cost, the deletion cost, and the substitution cost, a semantic edit distance between the first text phrase and the second text phrase in a semantic space. A degree of semantic similarity between the first text phrase and the second text phrase can be based on the semantic edit distance.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates the comparison of an example first text phrase to an example second text phrase for exemplar-based natural language processing according to various examples.

FIG. 2 illustrates an exemplary process for exemplar-based natural language processing according to various examples.

FIG. 3 illustrates an exemplary process for exemplar-based natural language processing according to various examples.

FIG. 4 illustrates an exemplary process for exemplar-based natural language processing of speech according to various examples.

FIG. 5 illustrates an exemplar semantic space according to various examples.

FIG. 6 illustrates a centroid position of an exemplar text phrase in a semantic space according to various examples.

FIG. 7 illustrates an exemplary system and environment for carrying out aspects of exemplar-based natural language processing according to various examples.

FIG. 8 illustrates an exemplary user device for carrying out aspects of exemplar-based natural language processing according to various examples.

FIG. 9 illustrates a functional block diagram of an exemplary electronic device according to various examples.

FIG. 10 illustrates a functional block diagram of an exemplary electronic device according to various examples.

FIG. 11 illustrates a functional block diagram of an exemplary electronic device according to various examples.

DETAILED DESCRIPTION

In the following description of examples, reference is made to the accompanying drawings in which it is shown by way of illustration specific examples that can be practiced. It is to be understood that other examples can be used and structural changes can be made without departing from the scope of the various examples.

The present disclosure relates to exemplar-based natural language processing. According to various examples described herein, exemplar-based natural language processing can be used to determine a user intent associated with an input text phrase by matching the input text phrase to a set of exemplar text phrases that are each associated with a predetermined intent. For example, the exemplar text phrase, “Where can I get money?” can be associated with the predetermined intent of finding a bank or an automatic teller machine (ATM). The input text phrase, “Where can I get some cash?” can be matched to the exemplar text phrase. Thus, the user intent associated with the input text phrase can be determined to be similar or identical to the predetermined intent associated with the exemplar text phrase.

In one example process, an input text phrase can be matched to the exemplar-text phrase by determining a degree of semantic similarity between the input text phrase and the exemplar text phrase. In this example, the input text phrase can be received. It can be determined whether editing the input text phrase to match an exemplar text phrase requires one or more of inserting a first word into the input text phrase, deleting a second word from the input text phrase, and substituting a third word of the input text phrase with a fourth word. The exemplar text phrase can include the first word, the input text phrase can include the second word, and the exemplar text phrase can include the fourth word. In response to determining that editing the input text phrase to match the exemplar text phrase requires one or more of inserting the first word into the input text phrase, deleting the second word from the input text phrase, and substituting the third word of the input text phrase with the fourth word, one or more of an insertion cost, a deletion cost, and a substitution cost can be determined. A semantic edit distance between the input text phrase and the exemplar text phrase in a semantic space can be determined based on one or more of the insertion cost, the deletion cost, and the substitution cost. The degree of semantic similarity between the input text phrase and the exemplar text phrase can be based on the semantic edit distance.

1. Exemplar-Based Natural Language Processes

FIG. 1 illustrates the comparison of first text phrase 102 to second text phrase 104 for exemplar-based natural language processing according to various examples. FIG. 2 illustrates process 200 for exemplar-based natural language processing according to various examples. Process 200, can be described with simultaneous reference to FIGS. 1 and 2.

At block 202 of process 200, first text phrase 102 can be received. First text phrase can be natural language text and can include a string of words. In this example, as shown in FIG. 1, first text phrase 102 can include the question, “You got any good stories to tell?” In other examples, the first text phrase can be any request, statement, exclamation, question, or the like. In some examples, the first text phrase can be less than 150 characters. First text phrase 102 can include a first intent that can be determined using exemplar-based natural language processing.

First text phrase 102 can be received via an interface of a user device (e.g., touch screen 846 or other input/control devices 848 of user device 702, described below). The interface can be any suitable device for inputting text. For example, the interface can be a keyboard/keypad, a touch screen implementing a virtual keyboard or a handwriting recognition interface, a remote control (e.g., television remote control), a scroll wheel interface, or the like. In some examples, first text phrase 102 can be received from a speech-to-text converter. In these examples, at least a portion of a received speech input can be transcribed into text via the speech-to-text converter. First text phrase 102 can include the transcribed text.

At blocks 204, 206, and 208 of process 200, it can be determined whether editing first text phrase 102 to match second text phrase 104 requires one or more of: a) inserting a first word into the first text phrase, b) deleting a second word from the first text phrase, and c) substituting a third word of the first text phrase with a fourth word. Second text phrase 104 can include the first word, first text phrase 102 can include the second word, and second text phrase 104 can include the fourth word.

Second text phrase 104 can be a predetermined text phrase. For example, second text phrase 104 can be an exemplar text phrase stored on the user device or a remote system and can be associated with a predetermined intent and/or a predetermined task to be performed. In this example, second text phrase 104 can be the predetermined question, “Do you have any interesting stories?” In this example, second text phrase 104 can be associated with the predetermined intent of requesting a story and/or the predetermined task of retrieving a story. In other examples, second text phrase 104 can be any predetermined natural language text that includes a string of words. Like first text phrase 102, second text phrase 104 can be any request, statement, exclamation, question or the like. In some cases, second text phrase 104 can also be less than 150 characters.

First text phrase 102 can be compared to second text phrase 104 to determine the types of edits that would be required in order for first text phrase 102 to match with second text phrase. In this example, second text phrase 104 can include first word “do” 106 for which first text phrase 102 does not include any corresponding word. Thus, at block 204, it can be determined that editing first text phrase 102 to match second text phrase 104 would require inserting first word “do” 106 into first text phrase 102.

In addition, first text phrase 102 can include second word “to” 108 for which second text phrase 104 does not include any corresponding word. Further, in this example, first text phrase 102 can include the word “tell” 110 for which second text phrase 104 does not include any corresponding word. Thus, at block 206, it can be determined that editing first text phrase 102 to match second text phrase 104 would require deleting second word 108 “to” and the word “tell” 110 from first text phrase 102.

Further, first text phrase 102 can include third word “got” 112 that is different from corresponding fourth word “have” 114 of second text phrase 104. Similarly, first text phrase 102 can include the word “good” 116 that is different from corresponding word “interesting” 118 of second text phrase 104. Thus, at block 208, it can be determined that editing first text phrase 102 to match second text phrase 104 would require substituting third word “got” 112 with fourth word “have” 114 and substituting the word “good” 116 with the word “interesting” 118.

At block 210 of process 200, an insertion cost associated with inserting first word “do” 106 into first text phrase 102 can be determined in response to determining that editing first text phrase 102 to match second text phrase 104 requires inserting first word “do” 106 into first text phrase 102. The insertion cost can be determined based on a first predetermined semantic cost and a salience of the first word. For example, the insertion cost, cost_(ins)(“do”)=i*salience(“do”), where i denotes the first predetermined semantic cost and salience(“do”) denotes the salience of the word “do.” Functions for deriving the salience of a given word, salience(w), are explained in greater detail below.

At block 212 of process 200, a first deletion cost associated with deleting second word “to” 108 from first text phrase 102 can be determined in response to determining that editing first text phrase 102 to match second text phrase 104 requires deleting second word “to” 108 from first text phrase 102. The first deletion cost can be determined based on a second predetermined semantic cost and a salience of second word “to” 106. For example, the first deletion cost, cost_(del)(“to”)=d*salience(“to”), where d denotes the second predetermined semantic cost and salience(“to”) denotes the salience of the word “to.” In some examples, the first predetermined semantic cost is greater than the second predetermined semantic cost. This can be because inserting an additional word to a text phrase typically changes the semantics of the text phrase significantly. Therefore, the cost associated with inserting a word should be greater than the cost associated with deleting a word.

Further, a second deletion cost associated with deleting the word “tell” 110 from first text phrase 102 can be determined in response to determining that editing first text phrase 102 to match second text phrase 104 requires deleting the word “tell” 110 from first text phrase 102. The second deletion cost can be determined in a similar or identical manner as the first deletion cost. For example, the second deletion cost, cost_(del)(“tell”)=d*salience(“tell”), where salience(“tell”) denotes the salience of the word ‘tell.”

At block 214 of process 200, a first substitution cost associated with substituting third word “got” 112 of first text phrase 102 with fourth word “have” 114 can be determined in response to determining that editing first text phrase 102 to match second text phrase 104 requires substituting third word “got” 112 of first text phrase 102 with fourth word “have” 114. The first substitution cost can be determined based on a salience of third word “got” 112, a salience of fourth word “have” 114, a semantic similarity between third word “got” 112 and fourth word “have” 114 in a semantic space, the first predetermined semantic cost, and the second predetermined semantic cost. For example, the first substitution cost: cost_(sub)(“got”,“have”)=(cost_(del)(“got”)+cost_(ins)(“have”))(1−similarity(“got”,“have”)) where cost_(del) (“got”) denotes the deletion cost associated with deleting third word “got” 112 from first phrase 102, cost_(ins)(“have”) denotes the insertion cost associated with inserting fourth word “have” 114 into first phrase 102, and similarity(“got”, “have”) denotes the semantic similarity between third word “got” 112 and fourth word “have” 114. Cost_(del)(“got”) can be determined in a similar or identical manner as cost_(del)(“tell”) described above at block 212 and can be based on the second predetermined semantic cost and the salience of third word “got” 112. Cost_(ins)(“have”) can be determined in a similar or identical manner as cost_(ins)(“do”) described above at block 210 and can be based on the first predetermined semantic cost and the salience of fourth word “have” 114. A detailed description for determining the semantic similarity between two words (e.g., “got” and “have”) in a semantic space is provided below.

Further, a second substitution cost associated with substituting the word “good” 116 of first text phrase 102 with the word “interesting” 118 is determined in response to determining that editing first text phrase 102 to match second text phrase 104 requires substituting the word “good” 116 of first text phrase 102 with the word “interesting” 118. The second substitution cost can be determined in a similar or identical manner as the first substitution cost. For example, the second substitution cost: cost_(sub)(“good”,“interesting”)=(cost_(del)(“got”)+cost_(ins)(“have”))(1−similarity(“got”,“have”))

It should be recognized that various modifications can be made for determining the insertion cost, the deletion cost, and the substitution cost. For example, various weighting factors can be included to adjust the relative cost associated with inserting, deleting, and substituting.

At block 216 of process 200, a semantic edit distance between first text phrase 102 and second text phrase 104 in a semantic space can be determined. The semantic edit distance can be determined based on one or more of the insertion cost, the deletion cost, and the substitution cost determined at blocks 210, 212, and 214. For example, the semantic edit distance can be a linear combination of the insertion cost, the first deletion cost, the second deletion cost, the first substitution cost, and the second substitution cost. Appropriate weighting factors can be applied to the various costs in determining the semantic edit distance. Further, the semantic space can be the same semantic space used to determine the semantic similarity between two words, described below.

At block 218 of process 200, a centroid distance between a centroid position of first text phrase 102 in the semantic space and a centroid position of second text phrase 104 in the semantic space can be determined. The semantic space can be the same semantic space used to determine semantic similarity between third word 112 and fourth word 114 at block 214. The centroid position of a text phrase can be determined based on the semantic position of one or more words of the text phrase in the semantic space. Further, the centroid position of the text phrase can be determined based on a salience of one or more words of the text phrase. For example, the centroid position of first text phrase 102 can be determined based on a weighted semantic position of one or more words of first text phrase 102 in the semantic space where the semantic position of the one or more words of first text phrase 102 is weighted by a salience of the one or more words of first text phrase 102. Additional details for determining centroid position of a text phrase are provided below.

At block 220 of process 200, a degree of semantic similarity between first text phrase 102 and second text phrase 104 can be determined. In some examples, the degree of semantic similarity between first text phrase 102 and second text phrase 104 can be determined based on the semantic edit distance of block 216 and/or the centroid distance of block 218. In one example, the degree of semantic similarity between first text phrase 102 and second text phrase 104 can be based on a linear combination of the semantic edit distance and the centroid distance. Various weighting factors can be applied to the linear combination of the semantic edit distance and the centroid distance.

At block 222 of process 200, a first intent associated with first text phrase 102 can be determined based on the degree of semantic similarity. For example, blocks 204 through 220 can be repeated to determine the degree of semantic similarity between first text phrase 102 and a plurality of text phrases. The plurality of text phrases can include the second text phrase. Further, the plurality of text phrases can be associated with a plurality of predetermined intents. In one example, it can be determined at block 222 that first text phrase 102 is most semantically similar to second text phrase 104 among the plurality of text phrases. In particular, the degree of semantic similarity can be based on the semantic edit distance and it can be determined that second text phrase 104 is associated with the lowest semantic edit distance among the plurality of text phrase. In this example, the first intent can be determined to be similar or identical to the predetermined intent associated with second text phrase 104. Specifically, the first intent can be determined to be similar or identical to the predetermined intent of requesting a story.

At block 224 of process 200, one or more tasks associated with first text phrase 102 can be performed based on the first intent. For example, the tasks of searching for a story on the Internet or a database and displaying a retrieved story can be performed based on the first intent of requesting a story.

Although blocks 202 through 224 of process 200 are shown in a particular order in FIG. 2, it should be appreciated that these blocks can be performed in any order. For instance, in some examples, block 218 can be performed prior to block 216. In addition, although process 200 is described above with reference to blocks 202 through 224, it should be appreciated that in some cases, process 200 can include additional blocks. For instance, in some examples, process 200 can include determining whether first text phrase 102 includes a fifth word that second text phrase 104 does not include and determining whether a predetermined list of keywords includes the fifth word. The predetermined list of keywords can include words that are highly salient and thus strongly influence the semantics of a given text phrase. For example, the predetermined list of keywords can include profane words. Accordingly, the degree of semantic similarity at block 220 can be based on whether first text phrase 102 includes a fifth word that second text phrase 104 does not include and whether a predetermined list of keywords includes the fifth word. For example, the degree of semantic similarity between first text phrase 102 and second text phrase 104 can be determined to be poor in response to determining that first text phrase 102 includes a profane word that second text phrase 104 does not include and a predetermined list of keywords includes the profane word.

Further, one or more blocks of process 200 can be optional and/or one or more blocks of process 200 can be combined. For instance, in some examples, block 218 of determining a centroid distance can be optional. In other examples, blocks 222 and 224 of determining a first intent and performing one or more tasks can be optional.

In some examples, blocks 204, 206, and 208 of process 200 can be combined. In these examples, it can be determined whether editing first text phrase 102 to match second text phrase 104 requires one or more of: a) inserting a first word into the first text phrase, b) deleting a second word from the first text phrase, and c) substituting a third word of the first text phrase with a fourth word. In other examples, blocks 210, 212, and 214 can be combined. In these examples, in response to determining that editing the first text phrase to match the second text phrase requires one or more of inserting the first word into the first text phrase, deleting the second word from the first text phrase, and substituting the third word of the first text phrase with the fourth word, one or more of an insertion cost, a deletion cost, and a substitution cost can be determined.

FIG. 3 illustrates process 300 for exemplar-based natural language processing according to various examples. Process 300 can be described with simultaneous reference to FIGS. 1 and 3.

At block 302 of process 300, first text phrase 102 can be received. Block 302 can be similar or identical to block 202 of process 200 described above.

At block 304 of process 300, one or more word-level differences of first text phrase 102 with respect to second text phrase 104 can be determined. Determining the one or more word-level differences can include comparing the words of first text phrase 102 to the words of second text phrase 104. Block 304 can be similar or identical to any combination of block 204, 206, and 208 of process 200. The one or more word-level differences can include one or more of a first word-level difference, a second word-level difference, and a third word-level difference.

A first word-level difference can comprise second text phrase 104 including a first word 106 that does not correspond to any word of first text phrase 102. For example, first word “do” 106 of second text phrase 104 does not correspond to any word of first text phrase 102. Thus, the absence of first word “do” 106 in first text phrase 102 can be determined to be a first word-level difference. Determining a first word-level difference can be similar or identical to determined whether editing first text phrase 102 to match second text phrase 104 would require inserting first word 106 into first text phrase 102, as described above in block 204 of process 200.

A second word-level difference can comprise first text phrase 102 including a second word 108 that does not correspond to any word of second text phrase 104. For example, second word “to” 108 of first text phrase 102 does not correspond to any word of second text phrase 104. Similarly, the word “tell” 110 of first text phrase 102 does not correspond to any word of second text phrase 104. Thus, second word “to” and/or the word “tell” of first text phrase 102 can be determined to be second word-level differences. Determining a second word-level difference can be similar or identical to determining whether editing first text phrase 102 to match second text phrase 104 would require deleting second word 108 and/or word 110 from first text phrase 102, as described above in block 206 of process 200.

A third word-level difference can comprise first text phrase 102 including third word 112 that is different from a corresponding fourth word 114 of second text phrase 104. For example, third word “got” 112 of first text phrase 102 can be different from corresponding fourth word “have” 114 of second text phrase 104. Similarly, the word “good” 116 of first text phrase 102 can be different from the corresponding word “interesting” 118 of second text phrase 104. Thus, third word “got” and/or the word “good” of first text phrase 102 can be determined to be third word-level differences. Determining a second word-level difference can be similar or identical to determining whether editing first text phrase 102 to match second text phrase 104 would require substituting third word 112 with fourth word 114 and/or substituting word 116 with word 118, as described above in block 208 of process 200.

At block 306, in response to determining that the one or more word-level differences include the first word-level difference, a first semantic cost associated with the first word-level difference can be determined. The first semantic cost can be based on a first predetermined semantic cost and the salience of the first word. The first semantic cost can be similar or identical to the insertion cost described above in block 210 of process 200 and can be determined in a similar or identical manner as the insertion cost.

At block 308 of process 300, in response to determining that the one or more word-level differences include the second word-level difference, a second semantic cost associated with the second word-level difference can be determined. The second semantic cost can be based on a second predetermined semantic cost and the salience of the second word. The second semantic cost can be similar or identical to the deletion cost described above in block 212 of process 200 and can be determined in a similar or identical manner as the deletion cost.

At block 310 of process 300, in response to determining that the one or more word-level differences include the third word-level difference, a third semantic cost associated with the third word-level difference can be determined. The third semantic cost can be based on the salience of the third word, the salience of the fourth word, the semantic similarity between the third word and the fourth word, a first predetermined semantic cost, and a second predetermined semantic cost. The third semantic cost can be similar or identical to the substitution cost described above in block 214 of process 200 and can be determined in a similar or identical manner as the substitution cost.

At block 312 of process 300, a total semantic cost associated with the one or more word-level differences can be based on the first semantic cost, the second semantic cost, and the third semantic cost. The total semantic cost can be determined in a similar or identical manner as the semantic edit distance described above in block 216 of process 200. For example, the total semantic cost can be equal to the linear combination of the first semantic cost, the second semantic cost, and the third semantic cost. As described above, the first semantic cost, the second semantic cost, and the third semantic cost can be based on one or more of a salience of the first word, a salience of the second word, a salience of the third word, a salience of the fourth word, and a semantic similarity between the third word and the fourth word in a semantic space.

At block 314 of process 300, a centroid distance between a centroid position of first text phrase 102 in the semantic space and a centroid position of second text phrase 104 in the semantic space can be determined. Block 314 can be similar or identical to block 218 of process 200 described above.

At block 316 of process 300, a degree of semantic similarity between first text phrase 102 and second text phrase 104 can be based on the total semantic cost and/or the centroid distance. For example, the degree of semantic similarity can be based on a linear combination of the total semantic cost and the centroid distance. Block 316 can be similar or identical to block 220 of process 200 described above.

At block 318 of process 300, a first intent associated with first text phrase 102 can be determined based on the degree of semantic similarity. Block 318 can be similar or identical to block 222 of process 200 described above.

At block 320 of process 300, one or more tasks associated with first text phrase 102 can be performed based on the first intent. Block 320 can be similar or identical to block 224 of process 200 described above.

Although blocks 302 through 320 of process 300 are shown in a particular order in FIG. 3, it should be appreciated that these blocks can be performed in any order and that some blocks can be combined. Further, one or more blocks of process 200 can be optional and/or one or more additional blocks can be included.

In some examples, process 300 can further include determining whether first text phrase 102 includes a fifth word that second text phrase 104 does not include and determining whether a predetermined list of keywords includes the fifth word. The degree of semantic similarity between first text phrase 102 and second text phrase can be based on whether first text phrase 102 includes a fifth word that second text phrase 104 does not include and whether a predetermined list of keywords includes the fifth word.

FIG. 4 illustrates process 400 for exemplar-based natural language processing of speech according to various examples. Exemplar-based natural language processing can be particularly advantageous for processing speech input for user intent. This can be because of exemplar-based natural language processing is less sensitive to the word-level errors that can typically be associated with speech-to-text conversion.

At block 402 of process 400, an input text phrase can be obtained from a received speech input. For example, the input text phrase can be obtained by performing speech-to-text conversion on the received speech input. Speech-to-text conversion can be performing using automatic speech recognition methods known in the art. The received speech input and the input text phrase can be in natural language form. The input text phrase can be similar or identical to first text phrase described above at block 302 of process 300.

At block 404 of process 400, it can be determining whether the input text phrase includes a sensitive word of a predetermined list of sensitive words. The sensitive word can be strongly associated with a particular intent. The salience of the sensitive word can thus be significant where a phrase that includes the sensitive word is likely associated with the particular intent. In some examples, the sensitive word is a profane word.

At block 406 of process 400, a degree of semantic similarity between the input text phrase and one or more exemplar text phrases can be determined in response to determining that the input text phrase does not include a sensitive word of a predetermined list of sensitive words. The degree of semantic similarity between the input text phrase and an exemplar text phrase of the one or more exemplar text phrases can be determined in a similar or identical manner as determining a degree of semantic similarity between the first text phrase and the second text phrase at blocks 304 through 316 of process 300, described above. Further, the exemplar text phrase can be similar or identical to the second text phrase at block 304 of process 300.

At block 408 of process 400, an exemplar text phrase that is most semantically similar to the input text phrase among the one or more exemplar text phrases can be identified based on the determined degree of semantic similarity between the input text phrase and the one or more exemplar text phrases. In a specific example, the degree of semantic similarity can be based on the total semantic cost. It can be determined that a first exemplar text phrase is associated with the lowest total semantic cost among those of the plurality of exemplar text phrases. Therefore, in such an example, the first exemplar text phrase can be identified as most semantically similar to the input text phrase among the one or more exemplar text phases.

At block 410 of process 400, a user intent associated with the received speech input can be determined based on the degree of semantic similarity between the input text phrase and the one or more exemplar text phrases. Block 410 can be similar or identical to block 318 of process 300.

In some examples, in response to determining at block 404 that the input text phrase includes a sensitive word of a predetermined list of sensitive words, a user intent associated with the received speech input can be determined based on a predetermined intent associated with the sensitive word. In particular, the user intent can be determined to be similar or identical to the predetermined intent associated with the sensitive word.

In other examples, in response to determining at block 404 that the input text phrase does not include a sensitive word of a predetermined list of sensitive words, a user intent associated with the received speech input can be determined based on a predetermined intent associated with the exemplar text phrase that is most semantically similar to the input text phrase at block 408.

At block 412 of process 400, one or more tasks associated with the received speech input can be determined based on the user intent. Block 412 can be similar or identical to block 320 of process 300.

Although blocks 402 through 412 of process 400 are shown in a particular order in FIG. 4, it should be appreciated that these blocks can be performed in any order and that some blocks can be combined. Further, one or more blocks of process 400 can be optional and/or one or more additional blocks can be included.

It should be recognized that the terms “first word,” “second word,” “third word,” “fourth word,” “fifth word” and the like described herein can, in some cases, refer to tokens that each represent a single word or a group of words that should be treated as a single unit. For instance, in one example, “first word” can be the single word “many”. In another example, “first word” can be the group of words “a lot of.”

The various processes for exemplar-based natural language processing described herein can be performed using a system implementing a client-server model, and more specifically, a system capable of implementing a virtual assistant (e.g., system 500, described below). In other examples, the processes for exemplar-based natural language processing described herein can be performed using a stand-alone electronic device (e.g., user device 502, described below).

2. Salience of a Word

The salience of a word can represent the influence the word has over a phrase. A highly salient word can greatly affect the semantics of a phrase. Thus, inserting, deleting, or substituting a highly salient word in a phrase can significantly change the meaning of the phrase. Conversely, a word with low salience does not greatly affect the semantics of a phrase. Thus inserting, deleting, or substituting a word with low salience in a phrase may not significantly change the meaning of the phrase.

The salience of a word can be determined based on the frequency of occurrence of the word in a corpus of text. For example, the salience of a word can be expressed by term frequency-inverse document frequency (tf-idf) or a variant thereof. In one example, a corpus of text can include multiple categories of text phrases that each includes a multiple text phrases. A category of text phrases can represent a particular context of text phrases or a particular topic of text phrases. For example, a category of text phrases can include text phrases associated with a particular intent. The salience of a word can be based on a proportion of the plurality of categories that include the word. This can be expressed as:

${{salience}(w)} = {1 - \frac{\left\{ {{c \in {categories}}❘{w \in c}} \right\} }{{categories}}}$ where salience(w) denotes a salience of a particular word, categories denotes the various categories in the corpus, c denotes a particular category in categories, and w denotes the word. In a specific example, if there are 100 categories in a corpus and a first word appears in 99 of the categories, the salience of the first word, salience(first word), can be equal to 1−(99/100)=0.01. Thus, words that appear in a large proportion of categories in the corpus can have low salience while words that appear in a small proportion of categories in the corpus can have high salience.

In other examples, the salience of a word can be determined based on a function representing the indexing power of a word. For example, the salience of a word can be determined based on the normalized entropy of the word in a corpus. In particular,

${{salience}(w)} = {1 - {\frac{1}{\log\; N}{\sum\limits_{c \in {categories}}{{p\left( {c❘w} \right)}\log\;{p\left( {c❘w} \right)}}}}}$ where N is the number of categories and p(c|w) is the probability that a word w is part of a phrase for the particular category c as opposed to other categories.

In yet other examples, the salience of a word can be arbitrarily determined. For example, the salience of a word in a predetermined list of sensitive words can be assigned an arbitrary value. In a specific example, a predetermined list of sensitive words can include a profane word and the salience of the profane word can be arbitrarily assigned a high salience.

3. Semantic Space, Semantic Similar, and Centroid Distance

The semantic similarity between two words (e.g., between third word 112 and fourth word 114, described above in block 208) can be determined using a semantic space. The semantic space can be an n-dimensional semantic space that is based on distributional semantics. Each word can be represented by a semantic position in the semantic space. The semantic position of a word can be expressed as a vector {right arrow over (v)}_(w). The semantics of words can be compared based on the semantic distance between their vectors. For example, the semantic distance between the vector of a third word and the vector of a fourth word can represent the semantic similarity between the third word and the fourth word in the semantic space. In some examples, the semantic similarity between the third word and the fourth word in a semantic space can refer to the semantic distance between the vector of the third word and the vector of the fourth word in the semantic space. The semantic distance between vectors can be determined by taking an inner product of the semantic vectors. For example, the semantic distance (e.g., semantic similarity) between word w₁ and word w₂ can be determined as follows: similarity_(word)(w ₁ ,w ₂)={right arrow over (v)} _(w1) ·{right arrow over (v)} _(w2) where {right arrow over (v)}_(w1) denotes the vector representing word w₁ in the semantic space and {right arrow over (v)}_(w2) denotes the vector representing word w₂ in the semantic space.

FIG. 5 illustrates semantic space 500 according to various examples. A plurality of points 502 are disposed in semantic space 500. Each point represents a semantic position of a word in semantic space 500. Words associated with points that are closer together in semantic space 500 are more semantically similar. Conversely, words associated with points that are further apart from each other are less semantically similar. For example, the semantic distance between the words “find” and “search” is less than the semantic distance between the words “find” and “shout.” Accordingly, the word “find” is more semantically similar to the word “search” than to the word “shout.”

Semantic space 500 can be derived from the distributions of words (e.g., a corpus) in a large body of unannotated text. In some examples, semantic space 500 can be derived from a corpus that includes a plurality of text phrases where each text phrase of the plurality of text phrases includes less than 150 characters. By using shorter text phrases to derive semantic space 500, semantic space 500 can be more suitable for virtual assistant applications where input texts can typically be short questions, requests, or statements that can be less than 150 characters.

A semantic space can also be used to determine the semantic similarity between text phrases. For example, the semantic similarity between a first text phrase and a second text phrase can be represented by a centroid distance in a semantic space. The centroid distance can be the distance between a centroid position of the first text phrase in the semantic space and a centroid position of the second text phrase in the semantic space. The centroid position of a text phrase can represent the semantics of the text phrase in the semantic space. The centroid position of a text phrase can be expressed as a vector {right arrow over (r)}(s) in the semantic space. For example, FIG. 6 illustrates centroid position 602 of text phrase 604 in semantic space 600 according to various examples. Semantic space 600 can be similar or identical to semantic space 500. Centroid position 602 of text phrase 604 can be determined based on a semantic position of one or more words of text phrase 602 in the semantic space.

As shown in FIG. 6, each word of text phrase 602 can be represented by a semantic position. For example, the word “stories” can be represented by semantic position 606. In some examples, centroid position 602 can be determined by combining the vectors {right arrow over (v)}_(w) of the words in text phrase 604. Further, in some examples, centroid position 602 of text phrase 604 can be determined based on a salience of one or more words of text phrase 604. For example, the vector {right arrow over (v)}_(w) of each word of text phrase 604 can be weighted by the salience of the word and the weighted vectors salience(w)·{right arrow over (v)}_(w) can be combined to determine centroid position 602. In particular,

${\overset{\rightarrow}{r}(s)} = {\sum\limits_{w \in s}{{{salience}(w)} \cdot {\overset{\rightarrow}{v}}_{w}}}$ where {right arrow over (r)}(s) denotes centroid position 602 of text phrase 604, salience(w) denotes the salience of a word of text phrase 604, {right arrow over (v)}_(w) denotes the semantic position of a word of text phrase 604, s denotes text phrase 604, and w denotes a word of text phrase 604.

In some examples, the centroid distance between a centroid position of a first text phrase in the semantic space and a centroid position of a second text phrase in the semantic space can be determined by L^2 normalizing the centroid position of the first text phrase and the centroid position of the second text phrase. For example:

${{similarity}_{centroid}\left( {s_{1},s_{2}} \right)} = \frac{{\overset{\rightarrow}{r}\left( s_{1} \right)} \cdot {\overset{\rightarrow}{r}\left( s_{2} \right)}}{{{\overset{\rightarrow}{r}\left( s_{1} \right)}}{{\overset{\rightarrow}{r}\left( s_{2} \right)}}}$ where similarity_(centroid)(s₁,s₂) denotes the centroid distance between the centroid position {right arrow over (r)}(s₁) of the first text phase s₁ and the centroid position {right arrow over (r)}(s₂) of the second text phrase s₂. 4. System and Environment

FIG. 7 illustrates system 700 for carrying out various aspects of exemplar-based natural language processing according to various examples. In some examples, system 700 can implement a virtual assistant. The terms “virtual assistant,” “digital assistant,” “intelligent automated assistant,” or “automatic digital assistant,” can refer to any information processing system (e.g., system 700) that can interpret natural language input in spoken and/or textual form to infer user intent, and perform actions based on the inferred user intent.

The virtual assistant can be capable of processing natural language input. For example, virtual assistant can be capable of performing speech recognition on a spoken input in order to obtain a textual representation of the spoken input. The textual representation can be analyzed to infer user intent. The virtual assistant can then act on the inferred user intent by performing one or more of the following: identifying a task flow with steps and parameters designed to accomplish the inferred user intent; inputting specific requirements from the inferred user intent into the task flow; executing the task flow by invoking programs, methods, services, APIs, or the like; and generating output responses to the user in an audible (e.g., speech) and/or visual form.

An example of a virtual assistant is described in Applicants' U.S. Utility application Ser. No. 12/987,982 for “Intelligent Automated Assistant,” filed Jan. 10, 2011, the entire disclosure of which is incorporated herein by reference

As shown in FIG. 7, in some examples, a virtual assistant can be implemented according to a client-server model. The virtual assistant can include a client-side portion executed on user device 702, and a server-side portion executed on server system 710. User device 702 can include any electronic device, such as a mobile phone, tablet computer, portable media player, desktop computer, laptop computer, PDA, television, television set-top box, wearable electronic device, or the like, and can communicate with server system 710 through one or more networks 708, which can include the Internet, an intranet, or any other wired or wireless public or private network. A detailed description of user device 702 is provided below with reference to FIG. 8. The client-side portion executed on user device 702 can provide client-side functionalities, such as user-facing input and output processing and communications with server system 710. Server system 710 can provide server-side functionalities for any number of clients residing on a respective user device 702.

Server system 710 can include one or more virtual assistant servers 714. As shown in FIG. 7, virtual assistant server 714 includes memory 728, one or more processors 726, client-facing I/O interface 722, and I/O interface to external services 716. The various components of virtual assistant server 714 can be coupled together by one or more communication buses or signal lines. Memory 728, or the computer-readable storage media of memory 728, can include one or more processing modules 718 and data and model storage 720. The one or more processing modules 718 can include various programs and instructions. The one or more processors 726 can execute the programs and instructions of the one or more processing modules 728 and read/write to/from data and model storage 720. In the context of this document, a “non-transitory computer-readable storage medium” can be any medium that can contain or store the program for use by or in connection with the instruction execution system, apparatus, or device.

In some examples, the one or more processing modules 718 can include various programs and instructions for performing various aspects of exemplar-based natural language processing (e.g., processes 200, 300, or 400, described above). In some examples, the one or more processing modules 718 can include a speech-to-text processing module, a natural language processing module, a task flow processing module, and a service processing module. The speech-to-text processing module can include instructions for transcribing a speech utterance in an audio input. The natural language processing module can include instructions for inferring user intent from the transcribed speech utterance. For example, the natural language processing model can include various instructions for exemplar-based natural language processing (e.g., processes 200, 300, or 400). The task flow processing module and the service processing module can include instructions for identifying a task flow to accomplish the inferred user intent, inputting specific requirements from the inferred user intent into the task flow, executing the task flow, and outputting relevant responses to the speech utterance. For example, the task flow processing module and the service processing module can include instructions for performing one or more task associated with the natural language input (e.g., blocks 224, 320, and 412, described above). Data and models 720 can include various user data and models that can be accessed or referenced when performing various aspects of exemplar-based natural language processing. For example, data and models 720 can include speech models, language models, task flow models, and service models.

In some examples, virtual assistant server 714 can communicate with external services 724, such as telephony services, calendar services, information services, messaging services, navigation services, and the like, through network(s) 708 for task completion or information acquisition. The I/O interface to external services 716 can facilitate such communications.

Server system 710 can be implemented on one or more standalone data processing devices or a distributed network of computers. In some examples, server system 710 can employ various virtual devices and/or services of third-party service providers (e.g., third-party cloud service providers) to provide the underlying computing resources and/or infrastructure resources of server system 710.

Although the functionality of the virtual assistant is shown in FIG. 7 as including both a client-side portion and a server-side portion, in some examples, the functions of the assistant can be implemented as a standalone application installed on a user device (e.g., user device 702). In addition, the division of functionalities between the client and server portions of the virtual assistant can vary in different examples. For instance, in some examples, one or more processing modules 718 and data and models 720 can be stored in the memory of user device 702 to enable user device to perform a greater proportion or all of the functionalities associated with the virtual assistant. In other examples, the client executed on user device 702 can be a thin-client that provides only user-facing input and output processing functions, and delegates all other functionalities of the virtual assistant to a backend server.

5. User Device

FIG. 8 is a block diagram of a user-device 702 according to various examples. As shown, user device 702 can include a memory interface 802, one or more processors 804, and a peripherals interface 806. The various components in user device 702 can be together coupled by one or more communication buses or signal lines. User device 702 can further include various sensors, subsystems, and peripheral devices that are coupled to the peripherals interface 806. The sensors, subsystems, and peripheral devices gather information and/or facilitate various functionalities of user device 702.

For example, user device 702 can include a motion sensor 810, a light sensor 812, and a proximity sensor 814 coupled to peripherals interface 806 to facilitate orientation, light, and proximity sensing functions. One or more other sensors 816, such as a positioning system (e.g., a GPS receiver), a temperature sensor, a biometric sensor, a gyroscope, a compass, an accelerometer, and the like, are also connected to peripherals interface 806, to facilitate related functionalities.

In some examples, a camera subsystem 820 and an optical sensor 822 can be utilized to facilitate camera functions, such as taking photographs and recording video clips. Communication functions can be facilitated through one or more wired and/or wireless communication subsystems 824, which can include various communication ports, radio frequency receivers and transmitters, and/or optical (e.g., infrared) receivers and transmitters. An audio subsystem 826 can be coupled to speakers 828 and a microphone 830 to facilitate audio-enabled functions, such as voice recognition, music recognition, voice replication, digital recording, and telephony functions. For example, user-device 702 can receive speech input (e.g., received speech input at block 402) via microphone 830.

In some examples, user device 702 can further include an I/O subsystem 840 coupled to peripherals interface 806. I/O subsystem 840 can include a touch screen controller 842 and/or other input controller(s) 844. Touch-screen controller 842 can be coupled to a touch screen 846. Touch screen 846 and the touch screen controller 842 can, for example, detect contact and movement or break thereof using any of a plurality of touch sensitivity technologies, such as capacitive, resistive, infrared, surface acoustic wave technologies, proximity sensor arrays, and the like. Other input controller(s) 844 can be coupled to other input/control devices 848, such as one or more buttons, rocker switches, keyboard, a thumb-wheel, an infrared port, a USB port, and/or a pointer device such as a stylus. In some examples, text input (e.g., block 202 and 302) can be received via a text inputting interface displayed on touch screen 846 or other input/control devices 848.

In some examples, user device 702 can further include a memory interface 802 coupled to memory 850. Memory 850 can include any electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, a portable computer diskette (magnetic), a random access memory (RAM) (magnetic), a read-only memory (ROM) (magnetic), an erasable programmable read-only memory (EPROM) (magnetic), a portable optical disc such as CD, CD-R, CD-RW, DVD, DVD-R, or DVD-RW, or flash memory such as compact flash cards, secured digital cards, USB memory devices, memory sticks, and the like. In some examples, a non-transitory computer-readable storage medium of memory 850 can be used to store instructions (e.g., for performing processes 200, 300, or 400, described above) for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. In other examples, the instructions (e.g., for performing process 200, 300, or 400, described above) can be stored on a non-transitory computer-readable storage medium of server system 710, or can be divided between the non-transitory computer-readable storage medium of memory 850 and the non-transitory computer-readable storage medium of server system 710.

In some examples, the memory 850 can store an operating system 852, a communication module 854, a graphical user interface module 856, a sensor processing module 858, a phone module 860, and applications 862. Operating system 852 can include instructions for handling basic system services and for performing hardware dependent tasks. Communication module 854 can facilitate communicating with one or more additional devices, one or more computers and/or one or more servers. Graphical user interface module 856 can facilitate graphic user interface processing. Sensor processing module 858 can facilitate sensor related processing and functions. Phone module 860 can facilitate phone-related processes and functions. Application module 862 can facilitate various functionalities of user applications, such as electronic-messaging, web browsing, media processing, navigation, imaging and/or other processes and functions.

As described herein, memory 850 can also store client-side virtual assistant instructions (e.g., in a virtual assistant client module 864) and various user data and models 866 to provide the client-side functionalities of the virtual assistant. The virtual assistant client module 864 can include modules, instructions, and programs for performing various aspects of processes 200, 300, or 400 described above. In some cases, the instructions for performing various aspects of process 100 can be stored in a separate module in memory 850. User data and models 866 can include user-specific vocabulary data, preference data, and/or other data such as the user's electronic address book, to-do lists, shopping lists, and the like. In addition, user data and models 866 can include speech models, language models, task flow models, and service models.

In various examples, virtual assistant client module 864 can include instructions for accepting natural language input (e.g., speech and/or text), touch input, and/or gestural input through various user interfaces (e.g., I/O subsystem 840, audio subsystem 826, or the like) of user device 702. Virtual assistant client module 864 can also include instructions for providing output in audio (e.g., speech and/or music output), visual, and/or tactile forms. For example, output can be provided as voice, music, sound, alerts, text messages, menus, graphics, videos, animations, vibrations, and/or combinations of two or more of the above. During operation, user device 702 can communicate with the virtual assistant server using communication subsystems 824 to perform the functionalities associated with the virtual assistant.

In various examples, memory 850 can include additional instructions or fewer instructions. Furthermore, various functions of user device 702 can be implemented in hardware and/or in firmware, including in one or more signal processing and/or application specific integrated circuits.

6. Electronic Device

FIG. 9 shows a functional block diagram of an electronic device 900 configured in accordance with the principles of the various described examples. The functional blocks of the device can be, optionally, implemented by hardware, software, or a combination of hardware and software to carry out the principles of the various described examples. It is understood by persons of skill in the art that the functional blocks described in FIG. 9 can be, optionally, combined, or separated into sub-blocks to implement the principles of the various described examples. Therefore, the description herein optionally supports any possible combination, separation, or further definition of the functional blocks described herein.

As shown in FIG. 9, electronic device 900 can include touch screen display unit 902 configured to display a user interface and to receive touch input, and audio receiving unit 904 configured to receive speech input. In some examples, electronic device 900 can include speaker unit 906 configured to generate sound and text receiving unit 908 configured to receive text. Electronic device 900 can further include processing unit 910 coupled to touch screen display unit 902 and audio receiving unit 904 (and, optionally, coupled to speaker unit 906 and text input receiving unit 908). In some examples, processing unit 910 can include receiving unit 912, determining unit 914, and performing unit 916.

Processing unit 910 can be configured to receive a first text phrase (e.g., from text receiving unit 908 or touch screen display unit 902 and using receiving unit 912). Processing unit 910 can be configured to determine (e.g., using determining unit 914) whether editing the first text phrase to match a second text phrase requires one or more of inserting a first word into the first text phrase, deleting a second word from the first text phrase, and substituting a third word of the first text phrase with a fourth word. The second text phrase includes the first word, the first text phrase includes the second word, and the second text phrase includes the fourth word. Processing unit 910 can be configured to determine (e.g., using determining unit 914) one or more of an insertion cost, a deletion cost, and a substitution cost in response to determining that editing the first text phrase to match the second text phrase requires one or more of inserting the first word into the first text phrase, deleting the second word from the first text phrase, and substituting the third word of the first text phrase with the fourth word. The insertion cost is associated with inserting the first word into the first text phrase, the deletion cost is associated with deleting the second word from the first text phrase, and the substitution cost is associated with substituting the third word of the first text phrase with the fourth word. Processing unit 910 can be configured to determine (e.g., using determining unit 914), based on the one or more of the insertion cost, the deletion cost, and the substitution cost, a semantic edit distance between the first text phrase and the second text phrase in a semantic space. A degree of semantic similarity between the first text phrase and the second text phrase is based on the semantic edit distance.

In some examples, processing unit 910 can be configured to determine (e.g., using determining unit 914), based on the degree of semantic similarity between the first text phrase and the second text phrase, a first intent associated with the first text phrase. In some examples, processing unit 910 can be configured to perform (e.g., using performing unit 914), based on the first intent, a task associated with the first text phrase.

In some examples, processing unit 910 can be configured to determine (e.g., using determining unit 914) the insertion cost associated with inserting the first word into the first text phrase in response to determining that editing the first text phrase to match the second text phrase requires inserting the first word into the first text phrase. The insertion cost is determined based on a first predetermined semantic cost and a salience of the first word.

In some examples, processing unit 910 can be configured to determine (e.g., using determining unit 914) the deletion cost associated with deleting the second word from the first text phrase in response to determining that editing the first text phrase to match the second text phrase requires deleting the second word from the first text phrase. The deletion cost is determined based on a second predetermined semantic cost and a salience of the second word.

In some examples, processing unit 910 can be configured to determine (e.g., using determining unit 914) the substitution cost associated with substituting the third word of the first text phrase with the fourth word in response to determining that editing the first text phrase to match the second text phrase requires substituting the third word of the first text phrase with the fourth word. The substitution cost is determined based on a salience of the third word, a salience of the fourth word, a semantic similarity between the third word and the fourth word in the semantic space, a first predetermined semantic cost, and a second predetermined semantic cost.

In some examples, the first predetermined semantic cost is higher than the second predetermined semantic cost.

In some examples, the salience of the first word is based on a frequency of occurrence of the first word in a first corpus. In some examples, the salience of the second word is based on a frequency of occurrence of the second word in the first corpus. In some examples, the salience of the third word is based on a frequency of occurrence of the third word in the first corpus. In some examples, the salience of the fourth word is based on a frequency of occurrence of the fourth word in the first corpus.

In some examples, the first corpus comprises a plurality of categories that includes a plurality of text phrases. The salience of the first word is based on a proportion of the plurality of categories that include the first word. The salience of the second word is based on a proportion of the plurality of categories that include the second word. The salience of the third word is based on a proportion of the plurality of categories that include the third word. The salience of the fourth word is based on a proportion of the plurality of categories that include the fourth word.

In some examples, the salience of the first word is based on a normalized entropy of the first word in a second corpus. The salience of the second word is based on a normalized entropy of the second word in the second corpus. The salience of the third word is based on a normalized entropy of the third word in the second corpus. The salience of the fourth word is based on a normalized entropy of the fourth word in the second corpus.

In some examples, the salience of the first word is based on whether a first predetermined list of sensitive words includes the first word. The salience of the second word is based on whether a second predetermined list of sensitive words includes the second word. The salience of the third word is based on whether a third predetermined list of sensitive words includes the third word. The salience of the fourth word is based on whether a fourth predetermined list of sensitive words includes the fourth word.

In some examples, processing unit 910 can be configured to determine (e.g., using determining unit 914) a centroid distance between a centroid position of the first text phrase in the semantic space and a centroid position of the second text phrase in the semantic space. The degree of semantic similarity between the first text phrase and the second text phrase is based on the centroid distance.

In some example, the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space and the centroid position of the second text phrase is determined based on a semantic position of one or more words of the second text phrase in the semantic space.

In some examples, the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase and the centroid position of the second text phrase is determined based on a salience of one or more words of the second text phrase.

In some examples, the degree of semantic similarity is based on a linear combination of the semantic edit distance and the centroid distance.

In some examples, the degree of semantic similarity is based on whether the first text phrase includes a fifth word that the second text phrase does not include and whether a predetermined list of keywords includes the fifth word.

In some examples, the semantic space is derived from a second corpus that includes a plurality of text phrases, and wherein each text phrase of the plurality of text phrases includes less than 150 characters.

FIG. 10 shows a functional block diagram of an electronic device 900 configured in accordance with the principles of the various described examples. The functional blocks of the device can be, optionally, implemented by hardware, software, or a combination of hardware and software to carry out the principles of the various described examples. It is understood by persons of skill in the art that the functional blocks described in FIG. 10 can be, optionally, combined, or separated into sub-blocks to implement the principles of the various described examples. Therefore, the description herein optionally supports any possible combination, separation, or further definition of the functional blocks described herein.

As shown in FIG. 10, electronic device 1000 can include touch screen display unit 1002 configured to display a user interface and to receive touch input, and audio receiving unit 1004 configured to receive speech input. In some examples, electronic device 1000 can include speaker unit 1006 configured to generate sound and text receiving unit 1008 configured to receive text. Electronic device 1000 can further include processing unit 1010 coupled to touch screen display unit 1002 and audio receiving unit 1004 (and, optionally, coupled to speaker unit 1006 and text input receiving unit 1008). In some examples, processing unit 1010 can include receiving unit 1012, determining unit 1014, and performing unit 1016.

Processing unit 1010 can be configured to receive a first text phrase (e.g., from text receiving unit 1008 or touch screen display unit 1002 and using receiving unit 1012). Processing unit 1010 can be configured to determine (e.g., using determining unit 1014) one or more word-level differences of the first text phrase with respect to a second text phrase. The one or more word-level differences can include one or more of a first word-level difference comprising the second text phrase including a first word that does not correspond to any word of the first text phrase, a second word-level difference comprising the first text phrase including a second word that does not correspond to any word of the second text phrase, and a third word-level difference comprising the first text phrase including a third word that is different from a corresponding fourth word of the second text phrase. Processing unit 1010 can be configured to determine (e.g., using determining unit 1014) a total semantic cost associated with the one or more word-level differences based on one or more of a salience of the first word, a salience of the second word, a salience of the third word, a salience of the fourth word, and a semantic similarity between the third word and the fourth word in a semantic space. A degree of semantic similarity between the first text phrase and the second text phrase is based on the total semantic cost.

In some examples, processing unit 1010 can be configured to determine (e.g., using determining unit 1014), based on the degree of semantic similarity between the first text phrase and the second text phrase, a first intent associated with the first text phrase. In some examples, processing unit 1010 can be configured to perform (e.g., using performing unit 1016), based on the first intent, a task associated with the first text phrase.

In some examples, processing unit 1010 can be configured to determine (e.g., using determining unit 1014), in response to determining that the one or more word-level differences include the first word-level difference, a first semantic cost associated with the first word-level difference based on a first predetermined semantic cost and the salience of the first word. The total semantic cost includes the first semantic cost.

In some examples, processing unit 1010 can be configured to determine (e.g., using determining unit 1014), in response to determining that the one or more word-level differences include the second word-level difference, a second semantic cost associated with the second word-level difference based on a second predetermined semantic cost and the salience of the second word. The total semantic cost includes the second semantic cost.

In some examples, the first predetermined semantic cost is higher than the second predetermined semantic cost.

In some examples, processing unit 1010 can be configured to determine (e.g., using determining unit 1014), in response to determining that the one or more word-level differences include the third word-level difference, a third semantic cost associated with the third word-level difference based on the salience of the third word, the salience of the fourth word, the semantic similarity between the third word and the fourth word, a first predetermined semantic cost, and a second predetermined semantic cost. The total semantic cost includes the third semantic cost.

In some examples, the salience of the first word is based on a frequency of occurrence of the first word in a first corpus. The salience of the second word is based on a frequency of occurrence of the second word in the first corpus. The salience of the third word is based on a frequency of occurrence of the third word in the first corpus. The salience of the fourth word is based on a frequency of occurrence of the fourth word in the first corpus.

In some examples, the first corpus comprises a plurality of categories that includes a plurality of text phrases. The salience of the first word is based on a proportion of the plurality of categories that include the first word. The salience of the second word is based on a proportion of the plurality of categories that include the second word. The salience of the third word is based on a proportion of the plurality of categories that include the third word. The salience of the fourth word is based on a proportion of the plurality of categories that include the fourth word.

In some examples, the salience of the first word is based on a normalized entropy of the first word in a second corpus. The salience of the second word is based on a normalized entropy of the second word in the second corpus. The salience of the third word is based on a normalized entropy of the third word in the second corpus. The salience of the fourth word is based on a normalized entropy of the fourth word in the second corpus.

In some examples, the salience of the first word is based on whether a first predetermined list of sensitive words includes the first word. The salience of the second word is based on whether a second predetermined list of sensitive words includes the second word. The salience of the third word is based on whether a third predetermined list of sensitive words includes the third word. The salience of the fourth word is based on whether a fourth predetermined list of sensitive words includes the fourth word.

In some examples, processing unit 1010 can be configured to determine (e.g., using determining unit 1014) a centroid distance between a centroid position of the first text phrase in the semantic space and a centroid position of the second text phrase in the semantic space. The degree of semantic similarity between the first text phrase and the second text phrase is based on the centroid distance.

In some examples, the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space and the centroid position of the second text phrase is determined based on a semantic position of one or more words of the second text phrase in the semantic space.

In some examples, the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase and the centroid position of the second text phrase is determined based on a salience of one or more words of the second text phrase.

In some examples, the degree of semantic similarity is based on a linear combination of the total semantic cost and the centroid distance.

In some examples, the degree of semantic similarity between the first text phrase and the second text phrase is based on whether the first text phrase includes a fifth word that the second text phrase does not include and whether a predetermined list of keywords includes the fifth word.

In some examples, the semantic space is derived from a third corpus that includes a plurality of text phrases, and wherein each text phrase of the plurality of text phrases includes less than 150 characters.

FIG. 11 shows a functional block diagram of an electronic device 900 configured in accordance with the principles of the various described examples. The functional blocks of the device can be, optionally, implemented by hardware, software, or a combination of hardware and software to carry out the principles of the various described examples. It is understood by persons of skill in the art that the functional blocks described in FIG. 11 can be, optionally, combined, or separated into sub-blocks to implement the principles of the various described examples. Therefore, the description herein optionally supports any possible combination, separation, or further definition of the functional blocks described herein.

As shown in FIG. 11, electronic device 1100 can include touch screen display unit 1102 configured to display a user interface and to receive touch input, and audio receiving unit 1104 configured to receive speech input. In some examples, electronic device 1100 can include speaker unit 1106 configured to generate sound and text receiving unit 1108 configured to receive text. Electronic device 1100 can further include processing unit 1110 coupled to touch screen display unit 1102 and audio receiving unit 1104 (and, optionally, coupled to speaker unit 1106 and text input receiving unit 1108). In some examples, processing unit 1110 can include receiving unit 1112, determining unit 1114, performing unit 1116, and identifying unit 1118.

Processing unit 1110 can be configured to obtain an input text phrase from a received speech input (e.g., from audio receiving unit 1104 and using obtaining unit 1112). Processing unit 1110 can be configured to determine (e.g., using determining unit 1114) a degree of semantic similarity between the input text phrase and one or more exemplar text phrases. Determining a degree of semantic similarity between the input text phrase and an exemplar text phrase of the one or more exemplar text phrases can comprises determining one or more word-level differences of the input text phrase with respect to the exemplar text phrase. Processing unit 1110 can be configured to determine (e.g., using determining unit 1114) one or more word-level differences of the input text phrase with respect to the exemplar text phrase. The one or more word-level differences include one or more of a first word-level difference comprising the exemplar text phrase including a first word that does not correspond to any word of the input text phrase, a second word-level difference comprising the input text phrase including a second word that does not correspond to any word of the exemplar text phrase, and a third word-level difference comprising the input text phrase including a third word that is different from a corresponding fourth word of the exemplar text phrase. Processing unit 1110 can be configured to determine (e.g., using determining unit 1114) a total semantic cost associated with the one or more word-level differences based on one or more of a salience of the first word, a salience of the second word, a salience of the third word, a salience of the fourth word, and a semantic similarity between the third word and the fourth word in a semantic space. A degree of semantic similarity between the input text phrase and the exemplar text phrase is based on the total semantic cost.

In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114), based on the degree of semantic similarity between the input text phrase and the exemplar text phrase, a user intent associated with the received speech input. In some examples, processing unit 1110 can be configured to perform (e.g., using performing unit 1116), based on the user intent, a task associated with the received speech input.

In some examples, processing unit 1110 can be configured to identify (e.g., using identifying unit 1118), based on the determined degree of semantic similarity, an exemplar text phrase that is most semantically similar to the input text phrase among the one or more exemplar text phrases. In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114) a user intent associated with the received speech input based on a predetermined intent associated with the exemplar text phrase that is most semantically similar to the input text phrase.

In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114) whether the input text phrase includes a sensitive word of a predetermined list of sensitive words. In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114), in response to determining that the input text phrase includes a sensitive word of a predetermined list of sensitive words, a user intent associated with the received speech input based on a predetermined intent associated with the sensitive word. In some examples, the degree of semantic similarity between the input text phrase and the one or more exemplar text phrases is determined in response to determining that the input text phrase does not include a sensitive word of a predetermined list of sensitive words.

In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114), in response to determining that the one or more word-level differences include the first word-level difference, a first semantic cost associated with the first word-level difference based on a first predetermined semantic cost and the salience of the first word. The total semantic cost can include the first semantic cost.

In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114), in response to determining that the one or more word-level differences include the second word-level difference, determining a second semantic cost associated with the second word-level difference based on a second predetermined semantic cost and the salience of the second word. The total semantic cost can include the second semantic cost.

In some examples, the first predetermined semantic cost is higher than the second predetermined semantic cost.

In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114), in response to determining that the one or more word-level differences include the third word-level difference, a third semantic cost associated with the third word-level difference based on the salience of the third word, the salience of the fourth word, the semantic similarity between the third word and the fourth word, a first predetermined semantic cost, and a second predetermined semantic cost. The total semantic cost can include the third semantic cost.

In some examples, the salience of the first word is based on a frequency of occurrence of the first word in a first corpus. The salience of the second word is based on a frequency of occurrence of the second word in the first corpus. The salience of the third word is based on a frequency of occurrence of the third word in the first corpus. The salience of the fourth word is based on a frequency of occurrence of the fourth word in the first corpus.

In some examples, the first corpus comprises a plurality of categories that includes a plurality of text phrases. The salience of the first word is based on a proportion of the plurality of categories that include the first word. The salience of the second word is based on a proportion of the plurality of categories that include the second word. The salience of the third word is based on a proportion of the plurality of categories that include the third word. The salience of the fourth word is based on a proportion of the plurality of categories that include the fourth word.

In some examples, the salience of the first word is based on a normalized entropy of the first word in a second corpus. The salience of the second word is based on a normalized entropy of the second word in the second corpus. The salience of the third word is based on a normalized entropy of the third word in the second corpus. The salience of the fourth word is based on a normalized entropy of the fourth word in the second corpus.

In some examples, the salience of the first word is based on whether a first predetermined list of sensitive words includes the first word. The salience of the second word is based on whether a second predetermined list of sensitive words includes the second word. The salience of the third word is based on whether a third predetermined list of sensitive words includes the third word. The salience of the fourth word is based on whether a fourth predetermined list of sensitive words includes the fourth word.

In some examples, processing unit 1110 can be configured to determine (e.g., using determining unit 1114), a centroid distance between a centroid position of the input text phrase in the semantic space and a centroid position of the exemplar text phrase in the semantic space. The degree of semantic similarity between the input text phrase and the exemplar text phrase is based on the centroid distance.

In some examples, the centroid position of the input text phrase is determined based on a semantic position of one or more words of the input text phrase in the semantic space and the centroid position of the exemplar text phrase is determined based on a semantic position of one or more words of the exemplar text phrase in the semantic space.

In some examples, the centroid position of the input text phrase is determined based on a salience of one or more words of the input text phrase and the centroid position of the exemplar text phrase is determined based on a salience of one or more words of the exemplar text phrase.

In some examples, the degree of semantic similarity is based on a linear combination of the total semantic cost and the centroid distance.

In some examples, the degree of semantic similarity between the input text phrase and the exemplar text phrase is based on whether the input text phrase includes a fifth word that the exemplar text phrase does not include and whether a predetermined list of keywords includes the fifth word.

In some examples, the semantic space is derived from a third corpus that includes a plurality of text phrases where each text phrase of the plurality of text phrases includes less than 150 characters.

Although examples have been fully described with reference to the accompanying drawings, it is to be noted that various changes and modifications will become apparent to those skilled in the art. Such changes and modifications are to be understood as being included within the scope of the various examples as defined by the appended claims.

In some cases, the systems, processes, and devices described above can include the gathering and use of data available from various sources to improve the delivery to users of invitational content or any other content that may be of interest to them. The present disclosure contemplates that in some instances, this gathered data may include personal information data that uniquely identifies or can be used to contact or locate a specific person. Such personal information data can include demographic data, location-based data, telephone numbers, email addresses, home addresses, or any other identifying information.

The present disclosure recognizes that the use of such personal information data in connection with the systems, processes, and devices described above, can be used to the benefit of users. For example, the personal information data can be used to deliver targeted content that is of greater interest to the user. Accordingly, use of such personal information data enables calculated control of the delivered content. Further, other uses for personal information data that benefit the user are also contemplated by the present disclosure.

The present disclosure further contemplates that the entities responsible for the collection, analysis, disclosure, transfer, storage, or other use of such personal information data will comply with well-established privacy policies and/or privacy practices. In particular, such entities should implement and consistently use privacy policies and practices that are generally recognized as meeting or exceeding industry or governmental requirements for maintaining personal information data private and secure. For example, personal information from users should be collected for legitimate and reasonable uses of the entity and not shared or sold outside of those legitimate uses. Further, such collection should occur only after receiving the informed consent of the users. Additionally, such entities would take any needed steps for safeguarding and securing access to such personal information data and ensuring that others with access to the personal information data adhere to their privacy policies and procedures. Further, such entities can subject themselves to evaluation by third parties to certify their adherence to widely accepted privacy policies and practices.

Despite the foregoing, the present disclosure also contemplates examples in which users selectively block the use of, or access to, personal information data. That is, the present disclosure contemplates that hardware and/or software elements can be provided to prevent or block access to such personal information data. For example, in the case of advertisement delivery services, the systems and devices described above can be configured to allow users to select to “opt in” or “opt out” of participation in the collection of personal information data during registration for services. In another example, users can select not to provide location information for targeted content delivery services. In yet another example, users can select to not provide precise location information, but permit the transfer of location zone information.

Therefore, although the present disclosure broadly covers use of personal information data to implement one or more various disclosed examples, the present disclosure also contemplates that the various examples can also be implemented without the need for accessing such personal information data. That is, the various examples disclosed herein are not rendered inoperable due to the lack of all or a portion of such personal information data. For example, content can be selected and delivered to users by inferring preferences based on non-personal information data or a bare minimum amount of personal information, such as the content being requested by the device associated with a user, other non-personal information available to the content delivery services, or publically available information. 

What is claimed is:
 1. A non-transitory computer-readable storage medium for natural language processing comprising computer-executable instructions for causing a processor to: receive a speech input representing a user request; generate a first text phrase corresponding to the speech input; determine, with respect to a semantic space, a plurality of semantic edit distances between the first text phrase and a plurality of exemplar text phrases, wherein each exemplar text phrase of the plurality of exemplar text phrases is associated with a respective predetermined intent of a plurality of predetermined intents; determine a plurality of centroid distances between a centroid position of the first text phrase in the semantic space and a plurality of centroid positions of the plurality of exemplar text phrases in the semantic space; determine a plurality of degrees of semantic similarity between the first text phrase and the plurality of exemplar text phrases, wherein each degree of semantic similarity of the plurality of degrees of semantic similarity is determined based on a linear combination of a respective semantic edit distance of the plurality of semantic edit distances and a respective centroid distance of the plurality of centroid distances; identify, based on the plurality of degrees of semantic similarity, a first exemplar text phrase of the plurality of exemplar text phrases, wherein the first exemplar text phrase is most semantically similar to the first text phrase among the plurality of exemplar text phrases, and wherein the first exemplar text phrase is associated with a first predetermined intent of the plurality of predetermined intents; determine, based on the identified first exemplar text phrase, a user intent corresponding to the first text phrase, wherein the determined user intent corresponds to the first predetermined intent; and in accordance with the determined user intent, perform one or more tasks responsive to the user request.
 2. The computer-readable storage medium of claim 1, wherein the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space, and wherein a centroid position of the first exemplar text phrase is determined based on a semantic position of one or more words of the first exemplar text phrase in the semantic space.
 3. The computer-readable storage medium of claim 1, wherein the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase, and wherein a centroid position of the first exemplar text phrase is determined based on a salience of one or more words of the first exemplar text phrase.
 4. The computer-readable storage medium of claim 1, wherein a first degree of semantic similarity of the plurality of degrees of semantic similarly is based on whether the first text phrase includes a first word that the first exemplar text phrase does not include and whether a predetermined list of keywords includes the first word.
 5. The computer-readable storage medium of claim 1, wherein determining a first semantic edit distance of the plurality of semantic edit distances comprises determining one or more cost values associated with editing the first text phrase to match the first exemplar text phrase.
 6. The computer-readable storage medium of claim 1, wherein the centroid position of the first text phrase comprises a weighted centroid of a plurality of points in the semantic space, and wherein each point of the plurality of points is a semantic representation of a respective word in the first text phrase.
 7. A non-transitory computer-readable storage medium for natural language processing comprising computer-executable instructions for causing a processor to: receive a speech input representing a user request; generate a first text phrase corresponding to the speech input; determine a plurality of sets of word-level differences between the first text phrase and a plurality of exemplar text phrases, wherein each exemplar text phrase of the plurality of exemplar text phrases is associated with a respective predetermined intent of a plurality of predetermined intents; determine a plurality of total semantic costs representing the plurality of sets of word-level differences between the first text phrase and the plurality of exemplar text phrases; determine a plurality of centroid distances between a centroid position of the first text phrase in a semantic space and a plurality of centroid positions of the plurality of exemplar text phrases in the semantic space; determine a plurality of degrees of semantic similarity between the first text phrase and the plurality of exemplar text phrases, wherein each degree of semantic similarity of the plurality of degrees of semantic similarity is determined based on a linear combination of a respective total semantic cost of the plurality of total semantic costs and a respective centroid distance of the plurality of centroid distances; identify, based on the plurality of degrees of semantic similarity, a first exemplar text phrase of the plurality of exemplar text phrases, wherein the first exemplar text phrase is most semantically similar to the first text phrase among the plurality of exemplar text phrases, and wherein the first exemplar text phrase is associated with a first predetermined intent of the plurality of predetermined intents; determine, based on the identified first exemplar text phrase, a user intent corresponding to the first text phrase, wherein the determined user intent corresponds to the first predetermined intent; and in accordance with the determined user intent, perform one or more tasks responsive to the user request.
 8. The computer-readable storage medium of claim 7, wherein the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space, and wherein a centroid position of the first exemplar text phrase is determined based on a semantic position of one or more words of the first exemplar text phrase in the semantic space.
 9. The computer-readable storage medium of claim 7, wherein the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase, and wherein a centroid position of the first exemplar text phrase is determined based on a salience of one or more words of the first exemplar text phrase.
 10. The computer-readable storage medium of claim 7, wherein a first degree of semantic similarity of the plurality of degrees of semantic similarity is based on whether the first text phrase includes a first word that the first exemplar text phrase does not include and whether a predetermined list of keywords includes the first word.
 11. The computer-readable storage medium of claim 7, wherein a first total semantic cost of the plurality of total semantic costs comprises a linear combination of a plurality of costs representing a first set of word-level differences of the plurality of sets of word-level differences, and wherein the first set of word-level differences is between the first text phrase and the first exemplar text phrase.
 12. The computer-readable storage medium of claim 7, wherein the centroid position of the first text phrase comprises a weighted centroid of a plurality of points in the semantic space, and wherein each point of the plurality of points is a semantic representation of a respective word in the first text phrase.
 13. A method for processing natural language comprising: at an electronic device having a processor and memory: receiving a speech input representing a user request; generating a first text phrase corresponding to the speech input; determining a plurality of sets of word-level differences between the first text phrase and a plurality of exemplar text phrases, wherein each exemplar text phrase of the plurality of exemplar text phrases is associated with a respective predetermined intent of a plurality of predetermined intents; determining a plurality of total semantic costs representing the plurality of sets of word-level differences between the first text phrase and the plurality of exemplar text phrases; determining a plurality of centroid distances between a centroid position of the first text phrase in a semantic space and a plurality of centroid positions of the plurality of exemplar text phrases in the semantic space; determining a plurality of degrees of semantic similarity between the first text phrase and the plurality of exemplar text phrases, wherein each degree of semantic similarity of the plurality of degrees of semantic similarity is determined based on a linear combination of a respective total semantic cost of the plurality of total semantic costs and a respective centroid distance of the plurality of centroid distances; identifying, based on the plurality of degrees of semantic similarity, a first exemplar text phrase of the plurality of exemplar text phrases, wherein the first exemplar text phrase is most semantically similar to the first text phrase among the plurality of exemplar text phrases, and wherein the first exemplar text phrase is associated with a first predetermined intent of the plurality of predetermined intents; determining, based on the identified first exemplar text phrase, a user intent corresponding to the first text phrase, wherein the determined user intent corresponds to the first predetermined intent; and in accordance with the determined user intent, performing one or more tasks responsive to the user request.
 14. The method of claim 13, wherein the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space, and wherein a centroid position of the first exemplar text phrase is determined based on a semantic position of one or more words of the first exemplar text phrase in the semantic space.
 15. The method of claim 13, wherein the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase, and wherein a centroid position of the first exemplar text phrase is determined based on a salience of one or more words of the first exemplar text phrase.
 16. The method of claim 13, wherein the centroid position of the first text phrase comprises a weighted centroid of a plurality of points in the semantic space, and wherein each point of the plurality of points is a semantic representation of a respective word in the first text phrase.
 17. An electronic device comprising: one or more processors; memory; and one or more programs, wherein the one or more program are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for: receiving a speech input representing a user request; generating a first text phrase corresponding to the speech input; determining a plurality of sets of word-level differences between the first text phrase and a plurality of exemplar text phrases, wherein each exemplar text phrase of the plurality of exemplar text phrases is associated with a respective predetermined intent of a plurality of predetermined intents; determining a plurality of total semantic costs representing the plurality of sets of word-level differences between the first text phrase and the plurality of exemplar text phrases; determining a plurality of centroid distances between a centroid position of the first text phrase in a semantic space and a plurality of centroid positions of the plurality of exemplar text phrases in the semantic space; determining a plurality of degrees of semantic similarity between the first text phrase and the plurality of exemplar text phrases, wherein each degree of semantic similarity of the plurality of degrees of semantic similarity is determined based on a linear combination of a respective total semantic cost of the plurality of total semantic costs and a respective centroid distance of the plurality of centroid distances; identifying, based on the plurality of degrees of semantic similarity, a first exemplar text phrase of the plurality of exemplar text phrases, wherein the first exemplar text phrase is most semantically similar to the first text phrase among the plurality of exemplar text phrases, and wherein the first exemplar text phrase is associated with a first predetermined intent of the plurality of predetermined intents; determining, based on the identified first exemplar text phrase, a user intent corresponding to the first text phrase, wherein the determined user intent corresponds to the first predetermined intent; and in accordance with the determined user intent, performing one or more tasks responsive to the user request.
 18. The electronic device of claim 17, wherein the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space, and wherein a centroid position of the first exemplar text phrase is determined based on a semantic position of one or more words of the first exemplar text phrase in the semantic space.
 19. The electronic device of claim 17, wherein the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase, and wherein a centroid position of the first exemplar text phrase is determined based on a salience of one or more words of the first exemplar text phrase.
 20. The electronic device of claim 17, wherein a first degree of semantic similarity of the plurality of degrees of semantic similarly is based on whether the first text phrase includes a first word that the first exemplar text phrase does not include and whether a predetermined list of keywords includes the first word.
 21. The device of claim 17, wherein a first total semantic cost of the plurality of total semantic costs comprises a linear combination of a plurality of costs representing a first set of word-level differences of the plurality of sets of word-level differences, and wherein the first set of word-level differences is between the first text phrase and the first exemplar text phrase.
 22. The device of claim 17, wherein the centroid position of the first text phrase comprises a weighted centroid of a plurality of points in the semantic space, and wherein each point of the plurality of points is a semantic representation of a respective word in the first text phrase.
 23. A method for processing natural language comprising: at an electronic device having a processor and memory: receiving a speech input representing a user request; generating a first text phrase corresponding to the speech input; determining, with respect to a semantic space, a plurality of semantic edit distances between the first text phrase and a plurality of exemplar text phrases, wherein each exemplar text phrase of the plurality of exemplar text phrases is associated with a respective predetermined intent of a plurality of predetermined intents; determining a plurality of centroid distances between a centroid position of the first text phrase in the semantic space and a plurality of centroid positions of the plurality of exemplar text phrases in the semantic space; determining a plurality of degrees of semantic similarity between the first text phrase and the plurality of exemplar text phrases, wherein each degree of semantic similarity of the plurality of degrees of semantic similarity is determined based on a linear combination of a respective semantic edit distance of the plurality of semantic edit distances and a respective centroid distance of the plurality of centroid distances; identifying, based on the plurality of degrees of semantic similarity, a first exemplar text phrase of the plurality of exemplar text phrases, wherein the first exemplar text phrase is most semantically similar to the first text phrase among the plurality of exemplar text phrases, and wherein the first exemplar text phrase is associated with a first predetermined intent of the plurality of predetermined intents; determining, based on the identified first exemplar text phrase, a user intent corresponding to the first text phrase, wherein the determined user intent corresponds to the first predetermined intent; and in accordance with the determined user intent, performing one or more tasks responsive to the user request.
 24. The method of claim 23, wherein the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space, and wherein a centroid position of the first exemplar text phrase is determined based on a semantic position of one or more words of the first exemplar text phrase in the semantic space.
 25. The method of claim 23, wherein the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase, and wherein a centroid position of the first exemplar text phrase is determined based on a salience of one or more words of the first exemplar text phrase.
 26. The method of claim 23, wherein a first degree of semantic similarity of the plurality of degrees of semantic similarly is based on whether the first text phrase includes a first word that the first exemplar text phrase does not include and whether a predetermined list of keywords includes the first word.
 27. The method of claim 23, wherein determining a first semantic edit distance of the plurality of semantic edit distances comprises determining one or more cost values associated with editing the first text phrase to match the first exemplar text phrase.
 28. The method of claim 23, wherein the centroid position of the first text phrase comprises a weighted centroid of a plurality of points in the semantic space, and wherein each point of the plurality of points is a semantic representation of a respective word in the first text phrase.
 29. An electronic device comprising: one or more processors; memory; and one or more programs, wherein the one or more program are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for: receiving a speech input representing a user request; generating a first text phrase corresponding to the speech input; determining, with respect to a semantic space, a plurality of semantic edit distances between the first text phrase and a plurality of exemplar text phrases, wherein each exemplar text phrase of the plurality of exemplar text phrases is associated with a respective predetermined intent of a plurality of predetermined intents; determining a plurality of centroid distances between a centroid position of the first text phrase in the semantic space and a plurality of centroid positions of the plurality of exemplar text phrases in the semantic space; determining a plurality of degrees of semantic similarity between the first text phrase and the plurality of exemplar text phrases, wherein each degree of semantic similarity of the plurality of degrees of semantic similarity is determined based on a linear combination of a respective semantic edit distance of the plurality of semantic edit distances and a respective centroid distance of the plurality of centroid distances; identifying, based on the plurality of degrees of semantic similarity, a first exemplar text phrase of the plurality of exemplar text phrases, wherein the first exemplar text phrase is most semantically similar to the first text phrase among the plurality of exemplar text phrases, and wherein the first exemplar text phrase is associated with a first predetermined intent of the plurality of predetermined intents; determining, based on the identified first exemplar text phrase, a user intent corresponding to the first text phrase, wherein the determined user intent corresponds to the first predetermined intent; and in accordance with the determined user intent, performing one or more tasks responsive to the user request.
 30. The electronic device of claim 29, wherein the centroid position of the first text phrase is determined based on a semantic position of one or more words of the first text phrase in the semantic space, and wherein a centroid position of the first exemplar text phrase is determined based on a semantic position of one or more words of the first exemplar text phrase in the semantic space.
 31. The electronic device of claim 29, wherein the centroid position of the first text phrase is determined based on a salience of one or more words of the first text phrase, and wherein a centroid position of the first exemplar text phrase is determined based on a salience of one or more words of the first exemplar text phrase.
 32. The electronic device of claim 29, wherein a first degree of semantic similarity of the plurality of degrees of semantic similarly is based on whether the first text phrase includes a first word that the first exemplar text phrase does not include and whether a predetermined list of keywords includes the first word.
 33. The device of claim 29, wherein determining a first semantic edit distance of the plurality of semantic edit distances comprises determining one or more cost values associated with editing the first text phrase to match the first exemplar text phrase.
 34. The device of claim 29, wherein the centroid position of the first text phrase comprises a weighted centroid of a plurality of points in the semantic space, and wherein each point of the plurality of points is a semantic representation of a respective word in the first text phrase. 